/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package frc.circuitrunners.Archive;
import edu.wpi.first.wpilibj.SpeedController;
/**
 * Superclass of all Drive classes
 * @author James
 */
public abstract class AbstractDrive extends Subsystem {
    protected static int FRONT_RIGHT = 0, FRONT_LEFT = 1, BACK_LEFT = 2, BACK_RIGHT = 3;
    protected SpeedController motorControllers[];
    protected double limit(double input){
        if(input < -1.0){
            return -1.0;
        } else if(input > 1.0){
            return 1.0;
        } else {
            return input;
        }
    }
    public void setFrontRight(int index){
        if(motorControllers.length == 2){
            throw new IllegalArgumentException("Incorrect Usage of Method: wrong number of drive motors, use setRight() instead");
        }
        if(index < 0 || index > motorControllers.length){
            throw new IllegalArgumentException("Index Out of Bounds. Expected: Between 0 and "
                    + motorControllers.length + ". Given: "+index);
        }
        FRONT_RIGHT = index;
    }
    public void setFrontLeft(int index){
        if(motorControllers.length == 2){
            throw new IllegalArgumentException("Incorrect Usage of Method: wrong number of drive motors, use setLeft() instead");
        }
        if(index < 0 || index > motorControllers.length){
            throw new IllegalArgumentException("Length of motor controllers array inccorect. Expected: Between 0 and "
                    + motorControllers.length + ". Given: "+index);
        }
        FRONT_LEFT = index;
    }   
    public void setBackRight(int index){
        if(motorControllers.length == 2){
            throw new IllegalArgumentException("Incorrect Usage of Method: wrong number of drive motors, use setRight() instead");
        }
        if(index < 0 || index > motorControllers.length){
            throw new IllegalArgumentException("Length of motor controllers array inccorect. Expected: Between 0 and "
                    + motorControllers.length + ". Given: "+index);
        }
        BACK_RIGHT = index;
    }   
    public void setBackLeft(int index){
        if(motorControllers.length == 2){
            throw new IllegalArgumentException("Incorrect Usage of Method: wrong number of drive motors, use setLeft() instead");
        }
        if(index < 0 || index > motorControllers.length){
            throw new IllegalArgumentException("Length of motor controllers array inccorect. Expected: Between 0 and "
                    + motorControllers.length + ". Given: "+index);
        }
        BACK_LEFT = index;
    }   
}
